﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


namespace AUV5.Web.Testing
{
    public partial class ListPageDemo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData(AspNetPager1.CurrentPageIndex);                                
            }
        }

        /// <summary>
        /// 分页绑定
        /// </summary>
        /// <param name="index"></param>
        public void BindData(int index)
        {
            int pageSize = 3; //页面内容数
            int pageIndex = index; //获取当前页数
            AspNetPager1.PageSize = pageSize;//设置页面内容数
            string where = "";//获取条件,不含where 关键字
            int outCounts = 1;
            int pageCount = 1;

            IList<AUV5.Model.ServiceInfo> list = AUV5.BLL.ServiceInfoBLL.Instance.GetServiceInfoListPage("ServiceInfo", "*", "ServiceID", where, "UpdateDate desc,ServiceID desc", 3, 0, pageSize, pageIndex, ref outCounts, ref pageCount);

            rptServiceInfo.DataSource = list;
            rptServiceInfo.DataBind();
            AspNetPager1.RecordCount = outCounts;


        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData(AspNetPager1.CurrentPageIndex);
        }
    }
}